<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>密码重置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <style>
        label, span {
            font-size: 16px;
        }

        .x-admin-sm .iconfont {
            font-size: 18px;
        }

        .layui-input:focus, .layui-textarea:focus {
            border-color: #01AAED !important
        }

        .layui-form-item {
            margin-bottom: 0;
        }

        .blur {
            -webkit-filter: blur(20px);
            -moz-filter: blur(20px);
            -ms-filter: blur(20px);
            filter: blur(20px);
        }

        .bg {
            height: 100%;
            width: 100%;
            background-image: url(../img/login_bg02.jpg);
            background-repeat: no-repeat;
            background-position: center center;
            position: absolute;
        }

        .wrap {
            height: 100%;
            width: 100%;
            background-color: rgba(0, 0, 0, 0);
            position: absolute;
        }

        .content {
            background-color: rgba(100, 100, 100, 0.2);
            padding: 20px;
            width: 410px;
            position: absolute;
            bottom: 50%;
            left: 50%;
            margin-bottom: -98px;
            margin-left: -225px;
        }

        .layui-form-label {
            padding-top: 5px;
            padding-bottom: 6px;
        }
        .logD.logDtip .p1 {
            display: inline-block;
            font-size: 24px;
            /*margin-top: 15px;*/
            margin-bottom: 15px;
            width: 86%;
        }

        .logD.logDtip {
            width: 86%;
            /*border-bottom: 1px solid #01AAED;*/
            margin-bottom: 10px;
            margin-top: 0;
            margin-right: auto;
            margin-left: auto;
            text-align: center;
        }


    </style>
    <!--可以在收藏夹中显示出图标-->
    <link rel="Bookmark" type="image/png" href="../../img/logo.png"/>
    <!--可以在地址栏中显示出图标-->
    <link rel="icon" type="image/png" href="../../img/logo.png"/>
    <link rel="shortcut icon" type="image/png" href="../../img/logo.png"/>
</head>
<body>
<div class="bg blur"></div>
<div class="wrap">
    <div class="content">
        <div class="logD logDtip">
            <p class="p1">重置密码</p>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <i class="iconfont">&#xe69f;</i></label>
            <div class="layui-input-inline">
                <input type="text" required lay-verify="required" id="email" autocomplete="off"
                       class="layui-input" placeholder="邮箱/登录名">
            </div>

            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button id='add' class="layui-btn layui-btn-normal" lay-filter="add" lay-submit=""
                    style="margin-top: 5px; width: 190px;height: 35px;font-size: 16px;background-color: #01AAED">重置
            </button>
        </div>
    </div>
</div>

</body>
<script src="../lib/jquery.min.js"></script>
<script src="../js/const.js"></script>
<script src="../js/util.js"></script>

<script>
    layui.use(['form', 'layer', 'jquery'],
        function () {
            var form = layui.form,
                layer = layui.layer;
            //监听提交
            form.on('submit(add)',
                function (data) {
                    // console.log(data);

                    var email = $('#email').val().trim();
                    if (email == null || email == "") {
                        layer.msg('邮箱不能为空', {icon: 2, time: msgTime});
                        return;
                    }
                    if (!util.checkEmail(email)){
                        layer.msg('邮箱格式不正确', {icon: 2, time: msgTime});
                        return;
                    }

                    var data = {};
                    data.email = email;
                    layer.confirm("确定要重置密码吗？",{icon:3},function (index) {
                        layer.load();
                        util.sendPOST("/reset_password", data, function (reponse) {
                            console.log(reponse);
                            layer.closeAll("loading");
                            if(reponse.status){
                                layer.msg('密码重置成功', {icon: 1, time: msgTime});
                            }else {
                                layer.msg(reponse.error_desc, {icon: 2, time: msgTime});
                            }
                        }, function (reponse) {
                            layer.msg('密码重置失败', {icon: 2, time: msgTime});
                        });
                    });

                });

        });</script>
</html>